<template>
  <c-tags
    class="quotation-priceType"
    :data="[
      {
        label: getLabel(flag),
        color:
          flag.priceType === quotationDict.priceType.pricing.value
            ? 'blue'
            : 'orange'
      }
    ]"
  ></c-tags>
</template>

<script>
import quotationDict from "@/dict/quotation";

export default {
  props: {
    flag: {
      type: Object
    }
  },
  data() {
    return {
      quotationDict
    };
  },
  computed: {
    getLabel() {
      return row => {
        let res;
        if (row.priceType === quotationDict.priceType.confirm.value) {
          res = this.$getEnum(quotationDict.priceType, row.priceType);
        } else {
          // 有slidePriceType字段则区分点价输入价格
          if (row.slidePriceType) {
            res = this.$getEnum(
              quotationDict.detailPriceType,
              row.slidePriceType
            );
          } else {
            res = this.$getEnum(quotationDict.priceType, row.priceType);
          }
        }
        return res;
      };
    }
  }
};
</script>
